package com.project.entity.qo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.ibatis.annotations.Param;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * @ProjectName:
 * @Package:
 * @ClassName:
 * @Author: ZhaoLongShi
 * @CreateDate:
 */
@Data
@Validated
public class UserQo {
    /**
     * 添加
     */
    public interface Add {
    }

    /**
     * 更新
     */
    public interface Update {
    }

    @Null(groups = Add.class, message = "不能手动添加ID")
    @NotNull(groups = Update.class, message = "需要指定ID")
    private Long userId;

    @NotNull(groups = {Add.class, Update.class}, message = "用户名不能为空")
    private String username;

    @NotNull(groups = {Add.class, Update.class}, message = "密码不能为空")
    @Pattern(regexp = "^(?=.[0-9])(?=.[a-zA-Z])(.{5,})$")
    private String password;

    @NotNull(groups = {Add.class, Update.class}, message = "手机号码不能为空")
    private Long phone;


    private String imgUrl;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date registerTime;




}
